//
//  RootTableViewCell.m
//  多玩盒子
//
//  Created by 刘胜 on 16/2/26.
//  Copyright © 2016年 刘胜. All rights reserved.
//

#import "RootTableViewCell.h"
#import "UIImageView+WebCache.h"
#define WIDTH [UIScreen mainScreen].bounds.size.width
#define HEIGHT [UIScreen mainScreen].bounds.size.height
#define WID [[UIScreen mainScreen] bounds].size.width / 375
#define HEI [[UIScreen mainScreen] bounds].size.height / 667

@interface RootTableViewCell ()

@property(nonatomic,strong)UIImageView * myImageView;
@property(nonatomic,strong)UILabel * nameLabel;
@property(nonatomic,strong)UILabel * longLable;

@end

@implementation RootTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatViews];
    }
    return self;
}

-(void)creatViews {
    _nameLabel  = [[UILabel alloc] initWithFrame:CGRectMake(WIDTH/5+20,10,WIDTH/3*2,30)];
    [self.contentView addSubview:_nameLabel];
    _longLable = [[UILabel alloc] initWithFrame:CGRectMake(WIDTH/5+20, 45, WIDTH/3*2, self.contentView.frame.size.height - _nameLabel.frame.origin.y)];
    [_longLable setTintColor:[UIColor grayColor]];
    _longLable.font = [UIFont boldSystemFontOfSize:14];
    _longLable.textColor = [UIColor grayColor];
    _longLable.numberOfLines = 0;
    [self.contentView addSubview:_longLable];
    _myImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, WIDTH/5, WIDTH/5)];
    [self.contentView addSubview:_myImageView];
}

-(void)setCellModel:(TopModel *)cellModel {
    _cellModel = cellModel;
    _nameLabel.text = _cellModel.title;
    _longLable.text = _cellModel.content;
    [_myImageView sd_setImageWithURL:[NSURL URLWithString:_cellModel.photo ]placeholderImage:[UIImage imageNamed:@""]];
    
}


@end
